home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / fly8111-.000 / fly8111- / fly8 / info.c < prev    next >
C/C++ Source or Header  |  1979-12-31  |  21KB  |  850 lines

  1. /* --------------------------------- info.c --------------------------------- */
  2.  
  3. /* This is part of the flight simulator 'fly8'.
  4.  * Author: Eyal Lebedinsky (eyal@ise.canberra.edu.au).
  5. */
  6.  
  7. /* Show text on the screen
  8. */
  9.  
  10. #include "plane.h"
  11.  
  12.  
  13. #define y0    Y0    /* avoid clash with math.h */
  14. #define y1    Y1
  15.  
  16. #define EV    EE(CV)
  17.  
  18. static int    x0 = 0, x1 = 0, xs = 0, xm = 0, y0 = 0, y1 = 0, x = 0, y = 0,
  19.         xd = 0, xw = 0, dx = 0, dy = 0;
  20.  
  21. LOCAL_FUNC void NEAR
  22. ScrNewline (void)
  23. {
  24.     y += dy;
  25.     x = x0;
  26.     if (y > y1) {
  27.         x0 += xs;
  28.         if (xs > 0 && x0 > x1)
  29.             x0 = 2;
  30.         if (xs < 0 && x0 < 0)
  31.             x0 = x1;
  32.         xm = x0 + xw;
  33.         x = x0;
  34.         y = y0 + dy;
  35.     }
  36. }
  37.  
  38. LOCAL_FUNC int NEAR
  39. ScrPrintf (const char *fmt, ...)
  40. {
  41.     va_list    ap;
  42.     int    i, c;
  43.     char    *p;
  44.     static char _Gbuf[256];
  45.  
  46.     va_start (ap, fmt);
  47.     i = vsprintf (_Gbuf, fmt, ap);
  48.     va_end (ap);
  49.  
  50.     for (p = _Gbuf; T(c = *p); ++p) {
  51.         switch (c) {
  52.         default:
  53.             if (x+xd > xm)
  54.                 ScrNewline ();
  55.             x += stroke_char (x, y, c, dx, ST_HELP);
  56.             break;
  57.         case '\n':
  58.             ScrNewline ();
  59.             break;
  60.         case '\r':
  61.             x = x0;
  62.             break;
  63.         case '\f':
  64.             y = y0 + dy;
  65.             x = x0;
  66.             break;
  67.         }
  68.     }
  69.     return (i);
  70. }
  71.  
  72. #define    NOVALUE    0x8000
  73.  
  74. LOCAL_FUNC void NEAR
  75. ScrOpt (char *title, int state)
  76. {
  77.     if (state)
  78.         ScrPrintf ("%s\n", title);
  79. }
  80.  
  81. LOCAL_FUNC void NEAR
  82. ScrOnOff (char *title, int state, int value)
  83. {
  84.     ScrPrintf ("%-9s %s", title, state ? "On" : "Off");
  85.     if (value != NOVALUE)
  86.         ScrPrintf (" %d\n", value);
  87.     else
  88.         ScrPrintf ("\n");
  89. }
  90.  
  91. LOCAL_FUNC void NEAR
  92. ScrValue (char *title, int value)
  93. {
  94.     ScrPrintf ("%-7s %d\n", title, value);
  95. }
  96.  
  97. LOCAL_FUNC int NEAR
  98. show_ang (char *line, ANGLE a)
  99. {
  100.     int    i, s, f;
  101.  
  102.     if (a < 0) {
  103.         s = -1;
  104.         a = -a;
  105.     } else
  106.         s = 1;
  107.  
  108.     i = ANG2DEG (a);
  109.     a -= DEG2ANG (i);
  110.     f = ANG2DEG (10*a);
  111.     sprintf (line, "%4d.%u", s*i, f);
  112.     return (strlen (line));
  113. }
  114.  
  115. LOCAL_FUNC void NEAR
  116. right_margin (int orgx, int orgy, int maxx, int maxy, int bss)
  117. {
  118.     dx = bss;
  119.     dy = bss;
  120.  
  121.     xs = -19*xd;
  122.     x0 = orgx + maxx + xs;
  123.     x1 = orgx - maxx + 2;
  124.     xm = x0 + xw;
  125.     y0 = orgy - maxy;
  126.     y1 = orgy + maxy;
  127.  
  128.     x = x0;
  129.     y = y0 + dy;
  130. }
  131.  
  132. LOCAL_FUNC void NEAR
  133. left_margin (int orgx, int orgy, int maxx, int maxy, int bss)
  134. {
  135.     dx = bss;
  136.     dy = bss;
  137.  
  138.     xs = -xw;
  139.     x0 = orgx - maxx + 2;
  140.     x1 = orgx + maxx - xs;
  141.     xm = x0 + xw;
  142.     y0 = orgy - maxy + dy;
  143.     y1 = orgy + maxy;
  144.  
  145.     x = x0;
  146.     y = y0 + dy;
  147. }
  148.  
  149. static char *HudTypeNames[] = {
  150.     "Classic", "FA18", "F16", "F15",
  151.     "Ether", "Flir", "Classic", "Classic"
  152. };
  153.  
  154. LOCAL_FUNC void NEAR
  155. screen_hud (void)
  156. {
  157.     int    i;
  158.  
  159.     if (!IS_PLANE(CV))
  160.         return;
  161.  
  162.     ScrOnOff ("hud",    EV->hud&HUD_ON,            NOVALUE);
  163.     i = (EV->hud1&HUD_TYPES)/HUD_TYPE;
  164.     ScrPrintf("type %u %s\n", i, HudTypeNames[i]);
  165.     ScrOnOff ("ILS",    EV->hud2&HUD_ILS,        EV->ils);
  166.  
  167.     ScrPrintf("parts:\n");
  168.     ScrOnOff (" altitude",    EV->hud2&HUD_ALTITUDE,        NOVALUE);
  169.     ScrOnOff (" speed",    EV->hud2&HUD_SPEED,        NOVALUE);
  170.     ScrOnOff (" heading",    EV->hud2&HUD_HEADING,        NOVALUE);
  171.     ScrOnOff (" border",    EV->hud1&HUD_BORDER,        NOVALUE);
  172.     ScrOnOff (" v vector",    EV->hud&HUD_VV,            NOVALUE);
  173.     ScrOnOff (" w line",    EV->hud2&HUD_VW,        NOVALUE);
  174.     ScrOnOff (" cross",    EV->hud&HUD_PLUS,        NOVALUE);
  175.     ScrOnOff (" pointer",    EV->hud&HUD_CURSOR,        NOVALUE);
  176.     ScrOnOff (" beta",    EV->hud2&HUD_BETA,        NOVALUE);
  177.     ScrOnOff (" director",    EV->hud2&HUD_DIRECTOR,        NOVALUE);
  178.     ScrOnOff (" waypoint",    EV->hud2&HUD_WAYPOINT,        NOVALUE);
  179.     ScrOnOff (" tracers",    EV->hud2&HUD_BTRAIL,        NOVALUE);
  180.     ScrOnOff (" ghost",    EV->hud3&HUD_GVV,        NOVALUE);
  181.     ScrOnOff (" truehead",    EV->hud3&HUD_TRUEHEADING,    NOVALUE);
  182.  
  183.     ScrPrintf("ground:\n");
  184.     ScrOnOff (" gnd ptr",    EV->hud1&HUD_PENDULUM,        NOVALUE);
  185.     ScrOnOff (" xbreak",    EV->hud2&HUD_XBREAK,        NOVALUE);
  186.     ScrOnOff (" xvar",    EV->hud3&HUD_XVAR,        NOVALUE);
  187.     ScrOnOff (" xgrid",    EV->hud2&HUD_XGRID,        NOVALUE);
  188.     ScrOnOff (" pullup",    EV->hud3&HUD_CUE,        NOVALUE);
  189.  
  190.     ScrOnOff ("ladder:",    EV->hud&HUD_LADDER,        NOVALUE);
  191.     ScrOnOff (" pinnd",    EV->ladder&LD_FIXED,        NOVALUE);
  192.     ScrOnOff (" right",    EV->ladder&LD_RIGHT,        NOVALUE);
  193.     ScrOnOff (" erect",    EV->ladder&LD_ERECT,        NOVALUE);
  194.     ScrOnOff (" color",    EV->ladder&LD_COLOR,        NOVALUE);
  195.     ScrOnOff (" funel",    EV->ladder&LD_FUNNEL,        NOVALUE);
  196.     ScrOnOff (" slant",    EV->ladder&LD_SLANT,        NOVALUE);
  197.     ScrOnOff (" zenit",    EV->ladder&LD_ZENITH,        NOVALUE);
  198.     ScrOnOff (" under",    EV->ladder&LD_UNDER,        NOVALUE);
  199.     ScrOnOff (" tip0",    EV->ladder&LD_TIP0,        NOVALUE);
  200.     ScrOnOff (" negtip",    EV->ladder&LD_NEGTIP,        NOVALUE);
  201.     ScrOnOff (" hold",    EV->ladder&LD_HOLD,        NOVALUE);
  202.     ScrOnOff ("  roll",    EV->ladder&LD_HOLDROLL,        NOVALUE);
  203.     ScrOnOff (" sun",    EV->ladder&LD_SUN,        NOVALUE);
  204.     ScrPrintf(" gap   %d\n", fmul (100, EV->ldgap));
  205.     ScrPrintf(" step  %d\n", fmul (100, EV->ldstep));
  206.     ScrPrintf(" step0 %d\n", fmul (100, EV->ldstep0));
  207.     ScrPrintf(" stepg %d\n", fmul (100, EV->ldstepg));
  208.     ScrPrintf(" tip   %d\n", fmul (100, EV->ldtip));
  209.     ScrPrintf(" ndash %d\n", EV->ldndash);
  210.  
  211.     ScrPrintf("options 1:\n");
  212.     ScrOnOff (" heading",    EV->hud2&HUD_FULLHEADING,    NOVALUE);
  213.     ScrOnOff (" knots",    EV->hud1&HUD_KNOTS,        NOVALUE);
  214.     ScrOnOff (" top",    EV->hud1&HUD_TOP,        NOVALUE);
  215.     ScrOnOff (" fine",    EV->hud&HUD_FINE,        NOVALUE);
  216.     ScrOnOff (" exfine",    EV->hud&HUD_XFINE,        NOVALUE);
  217.     ScrOnOff (" big",    EV->hud&HUD_BIG,        NOVALUE);
  218.     ScrPrintf(" scale len %d\n", EV->tapelen);
  219.     ScrPrintf(" area %dDeg\n", (int)EV->hudarea);
  220.     ScrOnOff (" cas",    EV->hud2&HUD_CALIBRATED,    NOVALUE);
  221.  
  222.     ScrPrintf("options 2:\n");
  223.     ScrOnOff (" aural",    EV->hud1&HUD_AALARM,        NOVALUE);
  224.     ScrOnOff (" visual",    EV->hud1&HUD_VALARM,        NOVALUE);
  225.     ScrOnOff (" panel",    EV->hud1&HUD_PANEL,        NOVALUE);
  226.     ScrPrintf(" font %d\n", (int)st.StFont);
  227.     ScrPrintf(" size %d/%d\n", (int)st.StFontSize, (int)dx);
  228.  
  229.     ScrPrintf("radar:\n");
  230.     ScrOnOff (" corner",    EV->hud1&HUD_CORNER,        NOVALUE);
  231.     ScrOnOff (" data",    EV->hud&HUD_DATA,        NOVALUE);
  232.     ScrOnOff (" dist",    EV->hud1&HUD_IDIST,        NOVALUE);
  233.     ScrOnOff (" name",    EV->hud1&HUD_INAME,        NOVALUE);
  234.     ScrOnOff (" acc vect",    EV->hud1&HUD_ACCVECT,        NOVALUE);
  235.     ScrOnOff (" reticle",    EV->hud&HUD_RETICLE,        NOVALUE);
  236.     ScrOnOff (" target",    EV->hud&HUD_TARGET,        NOVALUE);
  237.     ScrPrintf(" type %s\n",    EV->hud&HUD_ROSS ? "Ross" : "Eyal");
  238.     ScrOnOff (" limit",    EV->hud1&HUD_LIMIT,        NOVALUE);
  239.     ScrOnOff (" thick",    EV->hud1&HUD_THICK,        NOVALUE);
  240.     ScrOnOff (" hide",    EV->hud2&HUD_HIDETGT,        NOVALUE);
  241.     ScrOnOff (" tpointer",    EV->hud2&HUD_TPOINTER,        NOVALUE);
  242.     ScrOnOff (" vpointer",    EV->hud2&HUD_VPOINTER,        NOVALUE);
  243.  
  244.     ScrPrintf("hdd:\n");
  245.     ScrOnOff (" instr",    EV->hdd&HDD_INSTRUMENTS,    NOVALUE);
  246.     ScrOnOff (" nav",    EV->hdd&HDD_NAV,        NOVALUE);
  247.     ScrOnOff (" compass",    EV->hdd&HDD_COMPASS,        NOVALUE);
  248.     ScrOnOff ("  square",    EV->hdd&HDD_SQRCOMPASS,        NOVALUE);
  249.     ScrOnOff ("  ortho",    EV->hdd&HDD_ORTCOMPASS,        NOVALUE);
  250. }
  251.  
  252. static struct {
  253.     Uchar    name[4];
  254.     int    index;
  255. } StatsInfo[] = {
  256.     {"sndB", STAT_NETSENTBYTES},
  257.     {"sndL", STAT_NETSENTP},
  258.     {"sndP", STAT_NETSENTPACKETS},
  259.  
  260.     {"rcvB", STAT_NETRECEIVEDBYTES},
  261.     {"rcvL", STAT_NETRECEIVEDP},
  262.     {"rcvP", STAT_NETRECEIVEDPACKETS},
  263.  
  264.     {"sERs", STAT_NETERRSEND},
  265.     {"sERa", STAT_NETERRSENDA},
  266.     {"sERr", STAT_NETERRSENDSOFT},    /* send retry count exceeded */
  267.  
  268.     {"rERd", STAT_NETERRD},
  269.     {"rERc", STAT_NETERRCRC},
  270.     {"NoPl", STAT_NETERRNOPLAYER},
  271.     {"rERb", STAT_NETERRL},
  272.     {"Nois", STAT_NETERRNOISE},
  273.     {"rERl", STAT_NETERRPACKED},
  274.  
  275.     {"Fond", STAT_NETERRFOUND},
  276.     {"Lost", STAT_NETERRLOST},
  277.  
  278.     {"rOOO", STAT_NETERROOO},
  279.  
  280.     {"Debg", STAT_DEBUG},
  281.  
  282.     {"Mem ", STAT_MEMTOTAL},
  283.     {"MemM", STAT_MEMMAXUSED},
  284.     {"MemA", STAT_MEMALLOCED},
  285.     {"MemL", STAT_MEMLOW},
  286.     {"MemN", STAT_MEMNO},
  287.  
  288.     {"Mx<0", STAT_GRERRMOVEXLOW},
  289.     {"Mx>w", STAT_GRERRMOVEXHIGH},
  290.     {"My<0", STAT_GRERRMOVEYLOW},
  291.     {"My>h", STAT_GRERRMOVEYHIGH},
  292.     {"Dx<0", STAT_GRERRDRAWXLOW},
  293.     {"Dx>w", STAT_GRERRDRAWXHIGH},
  294.     {"Dy<0", STAT_GRERRDRAWYLOW},
  295.     {"Dy>h", STAT_GRERRDRAWYHIGH},
  296.     {"Bufl", STAT_ERRBUFLINE},
  297.  
  298.     {"CLot", STAT_TCLIPOUT},
  299.     {"CLin", STAT_TCLIPIN},
  300.     {"CLxx", STAT_TCLIPINOUT},
  301.     {"CLho", STAT_TCLIPOUTHARD},
  302.     {"CLhf", STAT_TCLIPOUTFAILED},
  303.     {"CLhi", STAT_TCLIPINHARD},
  304.     {"CLtt", STAT_TCLIPCOUNT},
  305.     {"Move", STAT_MOVECOUNT},
  306.     {"Draw", STAT_DRAWCOUNT},
  307.  
  308.     {"T1-0", STAT_TEMP1+0},
  309.     {"T1-1", STAT_TEMP1+1},
  310.     {"T1-2", STAT_TEMP1+2},
  311.     {"T1-3", STAT_TEMP1+3},
  312.     {"T1-4", STAT_TEMP1+4},
  313.     {"T1-5", STAT_TEMP1+5},
  314.     {"T1-6", STAT_TEMP1+6},
  315.     {"T1-7", STAT_TEMP1+7},
  316.     {"T1-8", STAT_TEMP1+8},
  317.     {"T1-9", STAT_TEMP1+9},
  318.  
  319.     {"T2-0", STAT_TEMP2+0},
  320.     {"T2-1", STAT_TEMP2+1},
  321.     {"T2-2", STAT_TEMP2+2},
  322.     {"T2-3", STAT_TEMP2+3},
  323.     {"T2-4", STAT_TEMP2+4},
  324.     {"T2-5", STAT_TEMP2+5},
  325.     {"T2-6", STAT_TEMP2+6},
  326.     {"T2-7", STAT_TEMP2+7},
  327.     {"T2-8", STAT_TEMP2+8},
  328.     {"T2-9", STAT_TEMP2+9},
  329.  
  330. {"", 0}};
  331.  
  332. LOCAL_FUNC void NEAR
  333. screen_net (void)
  334. {
  335.     PLAYER    *pl;
  336.  
  337.     ScrPrintf ("Time %s\n", show_time ("", st.present));
  338.     if (st.network & NET_INITED) {
  339.         ScrPrintf ("V %u", (int)st.ComVersion);
  340.         if (st.network & NET_NOBCAST)
  341.             ScrPrintf (" Nb");
  342.         if (st.network & NET_AUTOACCEPT)
  343.             ScrPrintf (" Aa");
  344.         if (st.network & NET_AUTODECLINE)
  345.             ScrPrintf (" Ad");
  346.         if (st.network & NET_AUTOCONNECT)
  347.             ScrPrintf (" Ac");
  348.         ScrPrintf ("\n");
  349.         ScrPrintf ("Remote players:\n");
  350.         for (pl = 0; T(pl = player_next (pl));) {
  351.             strncpy (st.filename, pl->name, 20);
  352.             strncat (st.filename, ":", 20);
  353.             strncat (st.filename, pl->team, 20);
  354.             if (pl->flags & PL_ACTIVE)
  355.                 ScrPrintf ("Act");
  356.             else if (pl->flags & PL_PENDREQUEST)
  357.                 ScrPrintf ("PnR");
  358.             else if (pl->flags & PL_PENDCONFIRM)
  359.                 ScrPrintf ("PnC");
  360.             else if (pl->flags & PL_PLAYING)
  361.                 ScrPrintf ("Ply");
  362.             else
  363.                 ScrPrintf ("Idl");
  364.             ScrPrintf (" %s\n", st.filename);
  365.             ScrPrintf ("  port %s\n",
  366.                 netport_name (pl->netport));
  367.             ScrPrintf ("  addr %s\n",
  368.                 netport_addr (pl->netport, pl->address));
  369.         }
  370.     } else
  371.         ScrPrintf ("Net not active\n");
  372. }
  373.  
  374. extern void FAR
  375. stats_show (void)
  376. {
  377.     int    i, j;
  378.     Ulong    lt;
  379.  
  380.     for (i = 0; StatsInfo[i].name[0]; ++i) {
  381.         if (T(lt = (Ulong)st.stats[j = StatsInfo[i].index]))
  382.             LogPrintf ("%2u) %-4.4s %13s\n",
  383.                 j, StatsInfo[i].name, show_ul (lt));
  384.     }
  385. }
  386.  
  387. LOCAL_FUNC void NEAR
  388. screen_modes (VIEW *view)
  389. {
  390.     int    i, n;
  391.  
  392.     ScrPrintf ("Flags  %4x\n", st.flags);
  393.     ScrOpt   ("Blanker", st.flags&SF_BLANKER);
  394.     ScrOpt   ("Land",    st.flags&SF_LANDSCAPE);
  395.     ScrOpt   ("Sky",     st.flags&SF_SKY);
  396.     ScrOpt   ("Verbose", st.flags&SF_VERBOSE);
  397.     ScrOpt   ("Smoke",   st.flags1&SF_SMOKE);
  398.     ScrOpt   ("G",       st.flags1&SF_USEG);
  399.  
  400.     ScrPrintf ("Stereo %u%+d ",  st.stereo, st.paralax);
  401.     if (st.flags1 & SF_STEREOREV)
  402.         ScrPrintf ("R");
  403.     if (st.flags1 & SF_HUDINFRONT)
  404.         ScrPrintf ("F");
  405.     ScrPrintf ("\n");
  406.  
  407.     ScrOpt   ("Dbl Buff",st.flags1&SF_DBUFFERING);
  408.     ScrValue ("Drones",  st.drones);
  409.     ScrValue ("Killers", st.killers);
  410.     ScrOnOff ("Zviews",  st.flags1&SF_EXTVIEW, st.extview);
  411.     ScrOnOff ("Zoom",    VP->zoom, VP->zoom);
  412.     ScrOnOff ("Gaze",    VP->rotz, ANG2DEG(VP->rotz));
  413.     ScrOnOff ("Info",    st.flags1&SF_INFO, st.info);
  414.     ScrOnOff ("Sound", st.quiet, st.quiet);
  415.     ScrPrintf ("%s\n", show_time ("Time  ", st.present));
  416.     if (st.ShutdownTime)
  417.         ScrPrintf ("%s\n", show_time ("Limit ", st.ShutdownTime));
  418.     ScrPrintf ("last obj %s\n", show_l (st.object_id));
  419.     if (IS_PLANE(CV)) {
  420.         ScrOnOff ("OnGround", EV->flags & PF_ONGROUND,    NOVALUE);
  421.         ScrOnOff ("No Stall", EV->flags & PF_NOSTALL,    NOVALUE);
  422.         ScrPrintf ("Auto ");
  423.         if (EV->flags & PF_AUTOFLAP)
  424.             ScrPrintf ("F");
  425.         if (EV->flags & PF_AUTOELEVATOR)
  426.             ScrPrintf ("E");
  427.         if (EV->flags & PF_AUTORUDDER)
  428.             ScrPrintf ("R");
  429.         ScrPrintf ("\n");
  430.         ScrPrintf ("Wpn ");
  431.         ScrPrintf ("%s %d", get_wname (EE(CV)->weapon),
  432.                 EV->stores[EV->weapon-1]);
  433.         if (EV->flags & PF_LIMITED)
  434.             ScrPrintf ("L");
  435.         ScrPrintf ("\n");
  436.         ScrPrintf ("Radar");
  437.         ScrPrintf ("%s", EV->radar&R_ON ? " On" : "");
  438.         ScrPrintf ("%s", EV->radar&R_LOCK ? " Lck" : "");
  439.         ScrPrintf ("%s", EV->radar&R_INTELCC ? " P" : "");
  440.         ScrPrintf ("\n");
  441.         n = 0;
  442.         if (EV->radar & R_SELECT3)
  443.             ScrPrintf (" Sbr"), ++n;
  444.         else if (EV->radar & R_SELECT20)
  445.             ScrPrintf (" Shd"), ++n;
  446.         else if (EV->radar & R_SELECT5)
  447.             ScrPrintf (" Svt"), ++n;
  448.         if (EV->radar&R_INTEL)
  449.             ScrPrintf (" Itl"), ++n;
  450.         i = (EV->radar&R_MODES) / R_MODE;
  451.         ScrPrintf (" M%d", i), ++n;
  452.         if (EV->flags&PF_AUTO)
  453.             ScrPrintf (" Aut"), ++n;
  454.         if (EV->flags&PF_CHASE)
  455.             ScrPrintf (" Chs"), ++n;
  456.         if (EV->flags&PF_KILL)
  457.             ScrPrintf (" Kil"), ++n;
  458.         if (n)
  459.             ScrPrintf ("\n"), n = 0;
  460.         if (EV->hudmode & HM_DECLUTTER)
  461.             ScrPrintf ("Declutter\n");
  462.     }
  463.  
  464.     ScrPrintf ("Debug ");
  465.     if (st.flags & SF_DEBUG)
  466.         ScrPrintf ("On ");
  467.     else
  468.         ScrPrintf ("Off ");
  469.     if (st.debug & DF_GPW)
  470.         ScrPrintf ("W");
  471.     if (st.debug & DF_GPX)
  472.         ScrPrintf ("X");
  473.     if (st.debug & DF_GPY)
  474.         ScrPrintf ("Y");
  475.     if (st.debug & DF_GPZ)
  476.         ScrPrintf ("Z");
  477.     ScrPrintf ("\n");
  478. }
  479.  
  480. #undef NOVALUE
  481.  
  482. static void NEAR
  483. screen_help (void)
  484. {
  485.     ScrPrintf ("A   reticle mode[ob]n");
  486.     ScrPrintf ("b   wheel brakes   \n");
  487.     ScrPrintf ("c   clear text     \n");
  488.     ScrPrintf ("C   chase target   \n");
  489.     ScrPrintf ("d   declutter HUD  \n");
  490.     ScrPrintf ("D   descend chute  \n");
  491.     ScrPrintf ("E   eject          \n");
  492.     ScrPrintf ("f   radar acq mode \n");
  493.     ScrPrintf ("g   landing gear   \n");
  494.     ScrPrintf ("h   help (also ?)  \n");
  495.     ScrPrintf ("i   intel mode     \n");
  496.     ScrPrintf ("j   radar on pilots\n");
  497.     ScrPrintf ("k   auto shoot     \n");
  498.     ScrPrintf ("l   lock radar     \n");
  499.     ScrPrintf ("m   show modes     \n");
  500.     ScrPrintf ("n   net stats      \n");
  501.     ScrPrintf ("o   observer select\n");
  502.     ScrPrintf ("O    +show all objs\n");
  503.     ScrPrintf ("p   pause          \n");
  504.     ScrPrintf ("q   quiet modes    \n");
  505.     ScrPrintf ("r   activate radar \n");
  506.     ScrPrintf ("s   show obj stats \n");
  507.     ScrPrintf ("S   reSupply plane \n");
  508.     ScrPrintf ("u   hud menu       \n");
  509.     ScrPrintf ("v   alternate view \n");
  510.     ScrPrintf ("w   weapon select  \n");
  511.     ScrPrintf ("W   remove weapons \n");
  512.     ScrPrintf ("x   calib. pointer \n");
  513.     ScrPrintf ("/*- view L/C/R     \n");
  514.     ScrPrintf ("]/[ flaps +/-      \n");
  515.     ScrPrintf ("}/{ spoilers +/-   \n");
  516.     ScrPrintf ("+   air brakes     \n");
  517.     ScrPrintf ("!   shell          \n");
  518.     ScrPrintf ("F1  shoot          \n");
  519.     ScrPrintf ("F2/3/4 rudder L/C/R\n");
  520.     ScrPrintf ("F5/6 zoom in/out   \n");
  521.     ScrPrintf ("F7/8 macro rec/play\n");
  522.     ScrPrintf ("ESC main menu      \n");
  523. }
  524.  
  525.  
  526. LOCAL_FUNC void NEAR
  527. screen_stats (void)
  528. {
  529.     OBJECT    *p;
  530.     int    i, j;
  531.     Ulong    lt;
  532.  
  533.     for (i = 0; StatsInfo[i].name[0]; ++i) {
  534.         if (T(lt = (Ulong)st.stats[j = StatsInfo[i].index]))
  535.             ScrPrintf ("%2u %-4.4s %s\n",
  536.                 j, StatsInfo[i].name, show_ul (lt));
  537.     }
  538.  
  539.     if (STATS_NETERRLOW[1])
  540.         ScrPrintf ("in  av %lu max %lu\n",
  541.             STATS_NETERRLOW[2]/STATS_NETERRLOW[0],
  542.             STATS_NETERRLOW[1]);
  543.     if (STATS_NETERRLOW[4])
  544.         ScrPrintf ("out av %lu max %lu\n",
  545.             STATS_NETERRLOW[5]/STATS_NETERRLOW[3],
  546.             STATS_NETERRLOW[4]);
  547.  
  548.     for (i = 0; i < O_INT; ++i) {
  549.         j = 0;
  550.         for (p = CO; p; p = p->next) {
  551.             if (p->name == i)
  552.                 ++j;
  553.         }
  554.         if (j)
  555.             ScrPrintf ("%4u %s\n", j, st.bodies[i]->title);
  556.     }
  557. }
  558.  
  559. LOCAL_FUNC void NEAR
  560. screen_debug (void)
  561. {
  562.     OBJECT    *target;
  563.  
  564.     if (CO)
  565.         ScrPrintf ("CO %04lu %04x %-6.6s\n",
  566.             CO->id%10000, (int)CO->flags, TITLE(CO));
  567.     else
  568.         ScrPrintf ("CO (null)\n");
  569.     ScrPrintf ("CC %04lu %04x %-6.6s\n",
  570.         CC->id%10000, (int)CC->flags, TITLE(CC));
  571.     ScrPrintf ("CV %04lu %04x %-6.6s\n",
  572.         CV->id%10000, (int)CV->flags, TITLE(CV));
  573.     if (IS_PLANE(CV) && T(target = EV->target)) {
  574.         if (target->id == EV->tid)
  575.             ScrPrintf ("TG %04lu %04x %-6.6s\n",
  576.                 target->id%10000, (int)target->flags,
  577.                 TITLE(target));
  578.         else
  579.             ScrPrintf ("TG %lu?%lu\n",
  580.                 target->id, EV->tid);
  581.     }
  582.     if (STATS_DEBUG)
  583.         ScrPrintf ("ERRS %s\n", show_ul ((Ulong)STATS_DEBUG));
  584. }
  585.  
  586. LOCAL_FUNC void NEAR
  587. screen_font (int orgx, int orgy, int dx, int dy)
  588. {
  589.     int    x, y;
  590.  
  591.     x = orgx-dx*6;                /* test: show font */
  592.     y = orgy-dy*3;
  593.  
  594.     y += dy;
  595.     stroke_str (x, y, " !\"#$%&'()*+,-./", dx, ST_INFO);
  596.     y += dy;
  597.     stroke_str (x, y, "0123456789:;<=>?", dx, ST_INFO);
  598.     y += dy;
  599.     stroke_str (x, y, "@ABCDEFGHIJKLMNO", dx, ST_INFO);
  600.     y += dy;
  601.     stroke_str (x, y, "PQRSTUVWXYZ[\\]^_", dx, ST_INFO);
  602.     y += dy;
  603.     stroke_str (x, y, "`abcdefghijklmno", dx, ST_INFO);
  604.     y += dy;
  605.     stroke_str (x, y, "pqrstuvwxyz{|}~\x7f", dx, ST_INFO);
  606. }
  607.  
  608. LOCAL_FUNC void NEAR
  609. screen_colors (void)
  610. {
  611.     int    i;
  612.     int    x, y;
  613.  
  614.     for (y = y0, i = 0; i < rangeof (st.colors); ++i) {
  615.         x = x0;
  616.         y += dy;
  617.         x += stroke_str (x, y, color_name (i), dx, ST_INFO);
  618.         stroke_str (x+dx,   y, color_rgb  (i), dx, st.colors[i]);
  619.     }
  620. }
  621.  
  622. LOCAL_FUNC void NEAR
  623. screen_alarm (int orgx, int orgy, int ss, int color)
  624. {
  625.     int    blink, dx;
  626. /*
  627.  * Put high priority alarms last to activate the most urgent aural warning.
  628. */
  629.     blink = ((int)st.present)&0x0080;
  630.     dx = stroke_size ("A", ss);
  631.  
  632.     if (O_CHUTE == CV->name && CV->R[Z] <= 0L) {
  633.         if ((st.flags & SF_MAIN) && blink)
  634.             stroke_str (orgx-dx*8, orgy, "WAIT", ss*4, color);
  635.     }
  636. }
  637.  
  638. extern void FAR
  639. screen_info (VIEW *view, int orgx, int orgy, int maxx, int maxy, int ss,
  640.     int mode)
  641. {
  642.     int    dd, x, y, mg, info, i, savefont, list;
  643.     Ulong    tt, tscore;
  644.     OBJECT    *p;
  645.     char    line[80], *l;
  646.  
  647.     if (!(p = CV))
  648.         return;
  649.  
  650.     savefont = font_set (0);
  651.  
  652.     dd = num_size (9L, ss);
  653.  
  654.     if (st.flags & SF_MAIN) {
  655.         xd = dd;
  656.         xw = 19*xd;
  657.  
  658.         right_margin (orgx, orgy, maxx, maxy, ss);
  659.  
  660.         switch (list = (st.flags & SF_LISTS)) {
  661.         case SF_MODES:
  662.             screen_modes (view);
  663.             break;
  664.         case SF_NET:
  665.             screen_net ();
  666.             break;
  667.         case SF_HUD:
  668.             screen_hud ();
  669.             break;
  670.         case SF_STATS:
  671.             screen_stats ();
  672.             break;
  673.         case SF_COLORS:
  674.             screen_colors ();
  675.             break;
  676.         default:
  677.             break;
  678.         }
  679.  
  680.         if (st.flags & SF_DEBUG)
  681.             screen_debug ();
  682.  
  683.         left_margin (orgx, orgy, maxx, maxy, ss);
  684.  
  685.         switch (list) {
  686.         case SF_HELP:
  687.             screen_help ();
  688.             break;
  689.         case SF_FONT:
  690.             font_set (savefont);
  691.             screen_font (orgx, orgy, ss, ss);
  692.             savefont = font_set (0);
  693.             break;
  694.         default:
  695.             break;
  696.         }
  697.  
  698.         for (x = 0; x < NHDD; ++x) {
  699.             if ((st.hdd[x].flags & HDF_ON) &&
  700.                 HDT_UPFRONT == st.hdd[x].type)
  701.                 break;
  702.         }
  703.         if (x >= NHDD)
  704.             show_menu (view, orgx, orgy, maxx, maxy, ss);
  705.  
  706.         msg_show (orgx, orgy, maxx, maxy, ss);
  707.  
  708.         edit_show (view, orgx, orgy, maxx, maxy, ss);
  709.     }
  710.  
  711.     y = orgy - maxy;
  712.     if (HDT_UPFRONT == mode) {
  713.         mg = orgx - maxx + 2;
  714.         info = st.info;
  715.     } else {
  716.         mg = orgx - (maxx>>1);
  717.         if (HDT_FRONT == mode && (st.flags1 & SF_INFO))
  718.             info = st.info;
  719.         else
  720.             info = 0;
  721.     }
  722.  
  723.     if (info) {                        /* times */
  724.         i = st.misc[0] - st.misc[1] - st.misc[2]
  725.             - st.misc[3] - st.misc[4] - st.misc[5];
  726.  
  727.         sprintf (line, "%3u %3u %3u %3u %3u %3u %3d ",
  728.             st.misc[0]/10, st.misc[1]/10, st.misc[2]/10,
  729.             st.misc[5]/10, st.misc[3]/10, st.misc[4]/10, i/10);
  730.         y += ss;
  731.         x = stroke_str (mg, y, line, ss, ST_INFO);
  732.         i = st.misc[0] > 100 ? 100000L/st.misc[0] : 999;
  733.         stroke_frac (mg+x, y, (long)i, 3, 1, ss, ST_INFO);
  734.         y += ss;
  735.         stroke_str (mg, y, "tot vid  3d  2d sim flp bal fps",
  736.                 ss, ST_HFG);
  737.     }
  738.  
  739.     if (2 == info) {
  740.         y += ss;
  741.         stroke_str (mg, y, (char *)show_time ("", st.present), ss,
  742.             ST_WFG);
  743.  
  744.         sprintf (line, "S%4u %4lu %4lu",
  745.             (int)st.nobjects, STATS_CLIPCOUNT,
  746.             STATS_DISPLAYLISTSIZE);
  747.         y += ss;
  748.         stroke_str (mg, y, line, ss, ST_INFO);
  749.  
  750.         sprintf (line, "C%4lu%4lu%4lu%4lu",
  751.             STATS_CLIPOUT, STATS_CLIPIN, STATS_CLIPINOUT,
  752.             STATS_CLIPOUTHARD + STATS_CLIPOUTFAILED
  753.                             + STATS_CLIPINHARD);
  754.         y += ss;
  755.         stroke_str (mg, y, line, ss, ST_INFO);
  756.  
  757.         sprintf (line, "P%6ld%6ld%6ld",
  758.             vuscale (CV->R[X]), vuscale (CV->R[Y]),
  759.             vuscale (CV->R[Z]));
  760.         y += ss;
  761.         stroke_str (mg, y, line, ss, ST_INFO);
  762.  
  763.         sprintf (line, "V%6d%6d%6d",
  764.             (int)vuscale (CV->V[X]), (int)vuscale (CV->V[Y]),
  765.             (int)vuscale (CV->V[Z]));
  766.         y += ss;
  767.         stroke_str (mg, y, line, ss, ST_INFO);
  768.  
  769.         if (IS_PLANE(CV)) {
  770.             sprintf (line, "v%6d%6d%6d",
  771.                 (int)vuscale (EV->v[X]),
  772.                 (int)vuscale (EV->v[Y]),
  773.                 (int)vuscale (EV->v[Z]));
  774.             y += ss;
  775.             stroke_str (mg, y, line, ss, ST_INFO);
  776.         }
  777.  
  778.         l = line;
  779.         sprintf (l, "A");
  780.         l += 1;
  781.         l += show_ang (l, CV->a[X]);
  782.         l += show_ang (l, CV->a[Y]);
  783.         l += show_ang (l, CV->a[Z]);
  784.         y += ss;
  785.         stroke_str (mg, y, line, ss, ST_INFO);
  786.  
  787.         l = line;
  788.         sprintf (l, "D");
  789.         l += 1;
  790.         l += show_ang (l, CV->da[X]*VONE);
  791.         l += show_ang (l, CV->da[Y]*VONE);
  792.         l += show_ang (l, CV->da[Z]*VONE);
  793.         y += ss;
  794.         stroke_str (mg, y, line, ss, ST_INFO);
  795.     } else if (3 == info) {
  796.         if (st.flags1 & SF_TESTING)
  797.             tt = st.present - st.test_start;
  798.         else
  799.             tt = st.present;
  800.         sprintf (line, "%s %u %lu %u", show_time ("", tt),
  801.             (int)st.ntargets, st.nbullets, (int)p->score);
  802.         y += ss;
  803.         stroke_str (mg, y, line, ss, ST_INFO);
  804.         y += ss;
  805.         x = mg;
  806.         if (st.flags1 & SF_TESTING) {
  807.             tscore = st.mscore - (tt/1000)*10L - st.nbullets*2L;
  808.             sprintf (line, "%ld ", tscore);
  809.             x += stroke_str (x, y, line, ss, ST_WFG);
  810.         }
  811.         sprintf (line, "%d", (int)(p->speed/VONE));
  812.         x += stroke_str (x, y, line, ss, ST_WFG);
  813.     }
  814.  
  815.     if (VP && !(st.flags & SF_BLANKER) && scenery (mode)) {
  816.         y = orgy - maxy;
  817.         if (VP->rotz) {
  818.             y += ss;
  819.             x = orgx-maxx+2;
  820.             x += stroke_char (x, y, 'p', ss, ST_HFG);
  821.             if (VP->rotz > 0)
  822.                 x += stroke_char (x, y, ' ', ss, ST_HFG);
  823.             x += stroke_num (x, y, ANG2DEG(VP->rotz), ss, ST_HFG);
  824.         }
  825.  
  826.         if (VP->rotx) {
  827.             y += ss;
  828.             x = orgx-maxx+2;
  829.             x += stroke_char (x, y, 'e', ss, ST_HFG);
  830.             if (VP->rotx > 0)
  831.                 x += stroke_char (x, y, ' ', ss, ST_HFG);
  832.             x += stroke_num (x, y, ANG2DEG(VP->rotx), ss, ST_HFG);
  833.         }
  834.  
  835.         if (VP->zoom) {
  836.             y += ss;
  837.             x = orgx-maxx+2;
  838.             x += stroke_str (x, y, "z ", ss, ST_HFG);
  839.             stroke_num (x, y, VP->zoom, ss, ST_HFG);
  840.         }
  841.     }
  842.  
  843.     screen_alarm (orgx, orgy, ss, ST_HFGI);
  844.     font_set (savefont);
  845. }
  846.  
  847. #undef y0
  848. #undef y1
  849. #undef EV
  850.